<script language="javascript">
function addcode(job, parameter) {
	text_area = document.getElementById("data");
	rangeobj = document.selection.createRange();
	
	if(rangeobj.text == "") {
		if(job == "b" || job == "i" || job == "center" || job == "code" || job == "font" || job == "fontcolor" || job == "fontsize") {
			tip = "<{$lan.inputtext}>";
			defaultinput = "";
		} else {
			tip = "<{$lan.inputurl}>";
			defaultinput = "http://";
		}
		obj = prompt(tip, defaultinput);
	} else {
		obj = rangeobj.text;
	}
	if(obj != null) {
		if(job == "b") {
			obj = "<b>" + obj + "</b>";
		}
		if(job == "i") {
			obj = "<i>" + obj + "</i>";
		}
		if(job == "center") {
			obj = "<center>" + obj + "</center>";
		}
		if(job == "image") {
			obj = "<img src='" + obj + "'>";
		}
		if(job == "font") {
			obj = "<font family='" + parameter + "'>" + obj + "</font>";
		}
		if(job == "fontcolor") {
			obj = "<font color='" + parameter + "'>" + obj + "</font>";
		}
		if(job == "fontsize") {
			obj = "<font size='" + parameter + "'>" + obj + "</font>";
		}
		if(job == "link") {
			obj = "<a href='" + obj + "'>" + obj + "</a>";
		}
		if(rangeobj.parentElement().type == "textarea") {
			rangeobj.text = obj;
		} else {
			text_area.value = text_area.value + obj;
		}
	} else {
		return false;
	}
}
function hotkey() {
	if(window.event.ctrlKey && window.event.keyCode == 13) {
		document.getElementById("s").click();
	}
}
</script>
<{$lan.font}>
<select onChange="addcode('font', this.value);this.value=''" name=font>
<option value=""><{$lan.pleasechoose}></option>
<option value="Arial">Arial</option>
<option value="Arial Black">Arial Black</option>
<option value="Courier New">Courier New</option>
</select>
<{$lan.fontsize}>
<select onChange="addcode('fontsize', this.value);this.value=''" name=fontsize>
<option value=""><{$lan.pleasechoose}></option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
</select>
<br>
<img src="images/editor/bold.gif" onclick="addcode('b', '')">
<img src="images/editor/italic.gif" onclick="addcode('i', '')">
<img src="images/editor/center.gif" onclick="addcode('center', '')">
<img src="images/editor/image.gif" onclick="addcode('image', '')">
<img src="images/editor/link.gif" onclick="addcode('link', '')">
<br><textarea name="data" cols="100" rows="20" onkeydown="hotkey()"><{$data}></textarea>